<template>
	<view class="content">
		<view class="search-wrapper">
			<uniSearchBar placeholder="请输入需要查询的商品" @confirm="search"/>
		</view>
		<scroll-view class="scroll-view_H" scroll-x="true">
			<view id="demo1" class="scroll-view-item_H">最新排序</view>
			<view id="demo2" class="scroll-view-item_H">价格排序</view>
			<view id="demo3" class="scroll-view-item_H">尺码筛选</view>
			<view id="demo3" class="scroll-view-item_H">价格筛选</view>
		</scroll-view>
		<view :style="'height:' + scrollH +'px;'">
			<scroll-view scroll-y="true" @scrolltoupper="getNewList" @scrolltolower="getNextList" :style="'height:' + scrollH +'px;'">
				<view class="list-wrapper">
					<view class="list-item">
						<image class="item-img" src="../../static/u16.jpg" mode="widthFix"></image>
						<view class="item-info">
							<text>Supreme 20SS Stars Crewneck</text><br/>
							<text>仓库名称：圣徒体育1号仓</text>
							<button type="default" class="animated item-btn" hover-class="pulse">查看详情</button>
						</view>
						<view class="item-price">
							<text>$ 1999</text>
						</view>
					</view>
					<view class="list-item">
						<image class="item-img" src="../../static/u16.jpg" mode="widthFix"></image>
						<view class="item-info">
							<text>Supreme 20SS Stars Crewneck</text><br/>
							<text>仓库名称：圣徒体育1号仓</text>
							<button type="default" class="animated item-btn" hover-class="pulse">查看详情</button>
						</view>
						<view class="item-price">
							<text>$ 1999</text>
						</view>
					</view>
					<view class="list-item">
						<image class="item-img" src="../../static/u16.jpg" mode="widthFix"></image>
						<view class="item-info">
							<text>Supreme 20SS Stars Crewneck</text><br/>
							<text>仓库名称：圣徒体育1号仓</text>
							<button type="default" class="animated item-btn" hover-class="pulse">查看详情</button>
						</view>
						<view class="item-price">
							<text>$ 1999</text>
						</view>
					</view>
					<view class="list-item">
						<image class="item-img" src="../../static/u16.jpg" mode="widthFix"></image>
						<view class="item-info">
							<text>Supreme 20SS Stars Crewneck</text><br/>
							<text>仓库名称：圣徒体育1号仓</text>
							<button type="default" class="animated item-btn" hover-class="pulse">查看详情</button>
						</view>
						<view class="item-price">
							<text>$ 1999</text>
						</view>
					</view>
					<view class="list-item">
						<image class="item-img" src="../../static/u16.jpg" mode="widthFix"></image>
						<view class="item-info">
							<text>Supreme 20SS Stars Crewneck</text><br/>
							<text>仓库名称：圣徒体育1号仓</text>
							<button type="default" class="animated item-btn" hover-class="pulse">查看详情</button>
						</view>
						<view class="item-price">
							<text>$ 1999</text>
						</view>
					</view>
					<view class="list-item">
						<image class="item-img" src="../../static/u16.jpg" mode="widthFix"></image>
						<view class="item-info">
							<text>Supreme 20SS Stars Crewneck</text><br/>
							<text>仓库名称：圣徒体育1号仓</text>
							<button type="default" class="animated item-btn" hover-class="pulse">查看详情</button>
						</view>
						<view class="item-price">
							<text>$ 1999</text>
						</view>
					</view>
					<view class="list-item">
						<image class="item-img" src="../../static/u16.jpg" mode="widthFix"></image>
						<view class="item-info">
							<text>Supreme 20SS Stars Crewneck</text><br/>
							<text>仓库名称：圣徒体育1号仓</text>
							<button type="default" class="animated item-btn" hover-class="pulse">查看详情</button>
						</view>
						<view class="item-price">
							<text>$ 1999</text>
						</view>
					</view>
					<view class="list-item">
						<image class="item-img" src="../../static/u16.jpg" mode="widthFix"></image>
						<view class="item-info">
							<text>Supreme 20SS Stars Crewneck</text><br/>
							<text>仓库名称：圣徒体育1号仓</text>
							<button type="default" class="animated item-btn" hover-class="pulse">查看详情</button>
						</view>
						<view class="item-price">
							<text>$ 1999</text>
						</view>
					</view>
					<view class="list-item">
						<image class="item-img" src="../../static/u16.jpg" mode="widthFix"></image>
						<view class="item-info">
							<text>Supreme 20SS Stars Crewneck</text><br/>
							<text>仓库名称：圣徒体育1号仓</text>
							<button type="default" class="animated item-btn" hover-class="pulse">查看详情</button>
						</view>
						<view class="item-price">
							<text>$ 1999</text>
						</view>
					</view>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	import uniSearchBar from '@/components/uni-search-bar/uni-search-bar.vue'
	export default {
		components: {
			uniSearchBar
		},
		data() {
			return {
				searchValue: '',
				scrollH: 800
			}
		},
		onNavigationBarButtonTap(e) {
			// 监听导航栏点击事件
			if(e.text === '个人信息') {
				
			}else if(e.text === '消息'){
				
			}
		},
		onLoad() {
			uni.getSystemInfo({
				success(res) {
					console.log(res)
					this.scrollH = res.windowHeight - uni.upx2px(200)
				}
			})
		},
		methods: {
			search(val) {
				this.searchValue = val.value
			},
			getNewList() {
				// 触顶刷新
				console.log('top')
			},
			getNextList() {
				// 触底刷新
				console.log('bottom')
			}	
		}
	}
</script>

<style lang="scss" scope>
	.search-wrapper {
		width: 100%;
		height: 100rpx;
	}
	.scroll-view_H {
		width:100%;
		height: 100rpx;
		white-space: nowrap;
		border-bottom: 1rpx solid #999999;
	}
	.scroll-view-item_H {
		display: inline-block;
		padding: 0 40rpx;
		color: #666666;
	}
	
	.list-wrapper {
		.list-item {
			display: flex;
			align-items: center;
			.item-img {
				width: 176rpx;
				margin-left: 10rpx;
				margin-right: 10rpx;
			}
			.item-info {
				.item-btn {
					float: left;
					width: 170rpx;
				}
			}
			.item-price {
				width: 120rpx;
			}
		}
	}
	
</style>
